package com.woniuxy;


import feign.Retryer;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

import static java.util.concurrent.TimeUnit.SECONDS;

/**
 * Hello world!
 *
 */
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
public class OrderApp
{
    public static void main( String[] args )
    {
        SpringApplication.run(OrderApp.class,args);
    }
    @LoadBalanced
    @Bean
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }
//    @Bean
//    public IRule randomRule() {
//        return new RandomRule();
//    }
//    @Bean
//    public Retryer feignRetryer() {
//        //重试策略: 100ms到1000ms结束，之间重试5次。
//        return new Retryer.Default(100, 1000, 5);
//    }
}
